#!/usr/bin/env python
# -*- coding: utf-8 -*-
#===============================================================================
# Copyright 2011 zod.yslin
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# 
# Author: zod.yslin
# Email: 
# File Name: readlines.py
# Description: 
#   f.readlines() returns a list containing all the lines of data in the file.
#   If given an optional parameter sizehint, it reads that many bytes from the 
#   file and enough more to complete a line, and returns the lines from that.
#   This is often used to allow efficient reading of a large file by lines,
#   but without having to load the entire file in memory.
#   Only complete lines will be returned.
# Edit History: 
#   2011-10-18    File created.
#===============================================================================
with open('readlines.py', 'r') as f:
    print(f.readlines())
    f.seek(0)
    for line in f:
        print line,
    print(f.closed)
print(f.closed)
